{% extends 'base.html' %}

{% block content %}
<a href="{% url 'core:leave_request_create' %}" class="btn btn-primary mb-3"><i class="bi bi-plus-circle me-2"></i>新增请假申请</a>
<table class="table table-striped">
    <thead class="table-dark">
        <tr>
            <th>学生</th>
            <th>请假日期</th>
            <th>原因</th>
            <th>操作</th>
        </tr>
    </thead>
    <tbody>
        {% for request in leave_requests %}
        <tr>
            <td>{{ request.student }}</td>
            <td>{{ request.start_date }} 至 {{ request.end_date }}</td>
            <td>{{ request.reason }}</td>
            <td>
                <a href="{% url 'core:leave_request_update' request.pk %}" class="btn btn-sm btn-warning"><i class="bi bi-pencil me-1"></i>编辑</a>
                <a href="{% url 'core:leave_request_delete' request.pk %}" class="btn btn-sm btn-danger"><i class="bi bi-trash me-1"></i>删除</a>
            </td>
        </tr>
        {% empty %}
        <tr><td colspan="4">暂无请假申请记录</td></tr>
        {% endfor %}
    </tbody>
</table>
{% endblock %}